package org.molamil.acto.types {
	import org.molamil.acto.core.parsers.ParserError;	
	import org.molamil.acto.types.NullTypeParser;	
	
	import flexunit.framework.TestCase;	
	
	/**
	 * @author Jorge Hernandez
	 */
	public class NullTypeParserTest extends TestCase {
		
		
		// PROPERTIES
		
		private var instance:NullTypeParser;
		
		
		// CONSTRUCTOR
		
		public function NullTypeParserTest(methodName:String = null) {
			super(methodName);
		}
		
		
		// PUBLIC METHODS
		
		override public function setUp():void {
			instance = new NullTypeParser();
		}
		
		override public function tearDown():void {
			instance = null;
		}
		
		public function testParse():void {
			
			assertNull("null parses to null", instance.parse(null));
			
			try {
				instance.parse("");
				fail("'' should fail");
			} catch (e:ParserError) {}
			
			try {
				instance.parse("null");
				fail("'null' should fail");
			} catch (e:ParserError) {}
			
			try {
				instance.parse(" null");
				fail("' null' should fail");
			} catch (e:ParserError) {}
			
			
		}
		
		
	}
	
}
